// pages/user/user.js
var app = getApp();
const utilMd5 = require('../../utils/md5');
const fetch = require("../../utils/fetch")


Page({

  /**
   * 页面的初始数据
   */
  data: {
    paytop: 'ok',
    payWay: '1'
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function () {

    console.log(app.loginUser)
    fetch("/prepay", {
      userId: app.loginUser.id
    }).then(res => {

    })


  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {

  },


  lol: function (e) {
    console.log(e)
    const wayId = e.currentTarget.id;
    this.setData({
      payWay: wayId
    })
  },
  chooseWay: function (e) {
    const wayId = e.currentTarget.id;
    this.setData({
      payWay: wayId
    })
  },
  payFor: function () {
    const myDate = new Date().getTime();
    wx.requestPayment({
      'timeStamp': myDate,
      'nonceStr': '',
      'package': '',
      'signType': 'MD5',
      'paySign': '',
      'success': function (res) {},
      'fail': function (res) {
        console.log(res)
      }
    })
  }
})